<template>
  <div class="reconciliation-container">
    <div class="efficiency-top">
      <el-row :gutter="20">
        <el-col :span="12">
          <div class="top-left top">
            <div class="top-left-title title">日销售统计</div>
            <div class="top-left-body body">
              <div class="top-left-body-item item">
                <span class="num">{{ dataNumTmp }}</span>
                <span class="name-title">当日销售量（个）</span>
              </div>
              <div class="top-left-body-item item">
                <span class="num">{{ dataMoneyTmp }}</span>
                <span class="name-title">当日销售额（元）</span>
              </div>
              <div class="top-left-body-item item">
                <span class="num">{{ dataIncomeTmp }}</span>
                <span class="name-title">当日分成（元）</span>
              </div>

            </div>
          </div>
        </el-col>
        <el-col
          :span="12"
        ><div class="top-right top">
          <div class="top-right-title title">月销售统计</div>
          <div class="top-right-body body">
            <div class="top-right-body-item item">
              <span class="num">{{ dataNumTmp }}</span>
              <span class="name-title">当月销售量（个）</span>
            </div>
            <div class="top-right-body-item item">
              <span class="num">{{ dataMoneyTmp }}</span>
              <span class="name-title">当月销售额（元）</span>
            </div>
            <div class="top-right-body-item item">
              <span class="num">{{ dataIncomeTmp }}</span>
              <span class="name-title">当月分成（元）</span>
            </div>

          </div>
        </div></el-col>
      </el-row>
    </div>

    <div class="efficiency-bottom">
      <div class="efficiency-bottom-search">
        <span class="paterner">合作商</span>
        <el-select v-model="value" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <span class="paterner">日期</span>
        <el-date-picker
          v-model="value2"
          type="daterange"
          align="right"
          unlink-panels
          range-separator="~"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
        <!-- <el-button style="height: 36px" @click="searchInfo">查询</el-button> -->
        <el-button type="primary">主要按钮</el-button>
      </div>
      <div class="efficiency-bottom-info">
        <span>笔数统计 ：<span class="total">33</span> 个</span>
        <span>收入统计 ：<span class="total">34</span> 元</span>
        <span>分成统计 ：<span class="total">1</span> 元</span>
      </div>
      <div class="table">
        <el-table
          :data="tableData"
          style="width: 100%"
        >
          <el-table-column
            prop="date"
            label="订单日期"
            width="180"
          />
          <el-table-column
            prop="ownerName"
            label="合作商"
            width="180"
          />
          <el-table-column
            prop="ratio"
            label="分成比例"
          />
          <el-table-column
            prop="orderTotalMoney"
            label="收入(元)"
          />
          <el-table-column
            prop="orderCount"
            label="笔数"
          />
          <el-table-column
            prop="totalBill"
            label="分成金额(元)"
          />
        </el-table>
      </div>

    </div>
  </div>
</template>
<script>
import { getCurrentNumRequest, getCurrentMoneyRequest, getCurrentIncomeRequest, getTableListRequest } from '../../api/reconciliation.js'
export default {
  name: '',
  data() {
    return {
      value2: '',
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: '',
      tableData: [],
      dataNum: {
        start: '2023-07-16',
        end: '2023-08-16'
      },
      dataMoney: {
        start: '2023-07-16',
        end: '2023-08-16'
      },
      dataIncome: {
        start: '2023-07-16',
        end: '2023-08-16'
      },
      dataNumTmp: null,
      dataMoneyTmp: null,
      dataIncomeTmp: null
    }
  },
  computed: {
  },
  created() {
    this.getCurrentNum()
    this.getCurrentMoney()
    this.getCurrentIncome()
    this.getTableList()
  },
  methods: {
    // 销售量
    async getCurrentNum() {
      const res = await getCurrentNumRequest(this.dataNum)
      console.log(res, 67)
      this.dataNumTmp = res.data
    },
    // 销售额
    async getCurrentMoney() {
      const res = await getCurrentMoneyRequest(this.dataMoney)
      console.log(res, 667)
      this.dataMoneyTmp = res.data
    },
    // 利润
    async getCurrentIncome() {
      const res = await getCurrentIncomeRequest(this.dataIncome)
      console.log(res, 6677)
      this.dataIncomeTmp = res.data
    },
    searchInfo() {
      // 搜索
    },

    async getTableList() {
      const res = await getTableListRequest({ start: '2023-01-01', end: '2023-12-01' })
      console.log(res, 22)
      this.tableData = res.data.currentPageRecords
    }
  }
}
</script>
<style lang='scss'  scoped>
.efficiency-top {
  margin-bottom: 20px;
}
.top {
  padding: 20px;
  background-color: pink;
  height: 166px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;

  .title {
    font-size: 16px;
    color: #333;
    height: 20px;
  }

  .body {
    display: flex;
    flex: 1;
    justify-content: space-around;
    align-items: center;

    .item {
      float: 1;
      display: flex;
      flex-direction: column;

      .num {
        font-size: 36px;
        margin-bottom: 8px;
      }
      .name-title {
        font-size: 12px;
      }
    }
  }
}

.efficiency-bottom{

  background-color: #fff;
  .efficiency-bottom-search{
    position: relative;
    padding: 20px;
      .paterner{
        margin-right: 12px;
      }

      .el-button{
        position: absolute;
        top: 21px;
        margin-left: 12px;
        height: 36px;
        line-height: 10px;
      }

  }
}

::v-deep
.el-select{
  margin-right: 12px;
  height: 36px;
  .el-input__inner{
      height: 36px;
   }
}

::v-deep
.el-range-editor.el-input__inner{
  padding: 0 10px;
  line-height: 36px;
  height: 36px;
}

.efficiency-bottom-info{
  padding: 20px;
  span{
    &:nth-child(2n){
    margin: 0 25px;
  }
  }

  .total{
    font-size: 26px;
    color: red;
  }
}

::v-deep .table{
  padding: 20px;

  .el-table td{
    border: 0;
  }
}
::v-deep .el-table th.is-leaf{
  border:0
}

::v-deep .el-table::before{
  height: 0;
}
</style>
